package chwgigs.swing.jdbc;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JSeparator;
import javax.swing.SwingUtilities;

import java.awt.Font;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Toolkit;

public class J26_SungJukMainFrame extends JFrame {

	private JPanel contentPane;
	
	private static J26_SungJukMainFrame frame;
	// JDialog 에서 부모 객체로 지정하기 쉽도록 
	// frame을 전역변수(static)으로 선언한다. 
	
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					frame = new J26_SungJukMainFrame();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}//

	public J26_SungJukMainFrame() {
		setIconImage(Toolkit.getDefaultToolkit().getImage(J26_SungJukMainFrame.class.getResource("/images/1385446275_anchor.png")));
		setTitle("성적처리 프로그램");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 800, 600);

		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);

		JMenu mnFile = new JMenu("파일 (F)");
		menuBar.add(mnFile);

		JMenuItem minew = new JMenuItem("새 성적 (N)");
		minew.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				new J26_SungJukNewData(frame);			
			}
		});
		minew.setIcon(new ImageIcon(J26_SungJukMainFrame.class.getResource("/images/1385384337_like.png")));
		mnFile.add(minew);

		JSeparator separator = new JSeparator();
		mnFile.add(separator);

		JMenuItem miexit = new JMenuItem("닫기 (X)");
		miexit.setIcon(new ImageIcon(J26_SungJukMainFrame.class
				.getResource("/images/icon.png")));
		miexit.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.exit(0);
			}
		});
		mnFile.add(miexit);

		JMenu mnView = new JMenu("보기 (V)");
		menuBar.add(mnView);

		JMenuItem milist = new JMenuItem("전체성적보기(L)");
		milist.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				new J26_SungJukShowList(frame);
			
			}
		});
		mnView.add(milist);

		JMenu mnHelp = new JMenu("Help (H)");
		mnHelp.setFont(new Font("맑은 고딕", Font.PLAIN, 12));
		menuBar.add(mnHelp);

		JMenuItem mihelp = new JMenuItem("도움말 (H)");
		mihelp.setSelectedIcon(new ImageIcon(J26_SungJukMainFrame.class
				.getResource("/javax/swing/plaf/metal/icons/Inform.gif")));
		mnHelp.add(mihelp);

		JSeparator separator_1 = new JSeparator();
		mnHelp.add(separator_1);

		JMenuItem miabout = new JMenuItem("프로그램 정보 (P)");
		miabout.addActionListener(new ActionListener() {

			public void actionPerformed(ActionEvent e) {
				
				new J26_SungJukAboutDialog(frame);  // Dialog 호출
			}
		});
		mnHelp.add(miabout);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);

		JLabel lblNewLabel = new JLabel("New label");
		lblNewLabel.setFont(new Font("Lucida Fax", Font.PLAIN, 12));
		lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
		lblNewLabel.setIcon(new ImageIcon(J26_SungJukMainFrame.class
				.getResource("/images/splashimages.jpg")));
		contentPane.add(lblNewLabel, BorderLayout.CENTER);
	}

}
